<template>
  <div>
    <div class="filter-item">
      <el-form label-width="100px">
        <el-form-item label="年份：">
          <el-date-picker
            v-model="date"
            value-format="yyyy-MM-dd"
            type="year"
            :editable="false"
            class="filter-item"
            placeholder="请选择年份"
            @change="changeYear"
          /></el-form-item>
      </el-form>
    </div>
    <div class="filter-item">
      <el-form label-width="100px">
        <el-form-item label="所属企业："><yhxx ref="yhxxForm" @change="changeYhxx(arguments)" /></el-form-item>
      </el-form>
    </div>
    <div class="filter-item">
      <el-form label-width="100px">
        <el-form-item label="线路："><xl ref="xlForm" @change="changeXl(arguments)" /></el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
import Yhxx from '@/views/database/yhxx.vue';
import Xl from '@/views/database/xl.vue';

export default {
  name: 'Search',
  components: { Yhxx, Xl },
  props: {
    year: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      date: ''
    };
  },
  mounted() {
    this.date = this.year;
  },
  methods: {
    changeYhxx(data) {
      this.$emit('change', 'Yhxx', data[0]);
    },
    changeXl(data) {
      this.$emit('change', 'Xl', data[0]);
    },
    changeYear(data) {
      this.$emit('change', 'Year', data);
    }
  }
};
</script>
